package com.itheima.web;

import com.itheima.servcie.PeachblossomService;
import com.itheima.template.OssTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {
    @Autowired
    private PeachblossomService peachblossomService;

    /**
     * 发送语音
     * @param soundFile
     * @return
     */
    @PostMapping
    public ResponseEntity send(MultipartFile soundFile){
        peachblossomService.send(soundFile);
        return ResponseEntity.ok("发送成功");
    }

    /**
     * 接收语音
     * @return
     */
    @GetMapping
    public ResponseEntity receive(){
        return ResponseEntity.ok(peachblossomService.receive());
    }
}
